<?php
    Connection::getConnect();
	if (COUNT($_POST) > 0)
	{
    	if ($this->get('getu') == 1)
    	{
        	$sql = "SELECT * FROM login WHERE type>2 AND NOT aid=10000;";
        	Connection::setQuery($sql);
        	$result = Connection::fetchAll(MYSQL_ASSOC);
    		echo json_encode($result);
    		exit;
    	}
		
    	if ($this->get('sabe') == 1)
    	{
			$base_url = $this->get('base_url');
			$time_zone = $this->get('time_zone');
			$name = $this->get('name');
			
        	$sql = "UPDATE settings SET base_url='%s', time_zone='%s', name = '%s';";
        	Connection::setQueryf($sql, $base_url, $time_zone, $name);
    		exit;
    	}
		
    	if ($this->get('changeset') == 1)
    	{
			$aid= $this->get('aid');
			$val = $this->get('val');
			
        	$sql = "UPDATE login SET type=%d WHERE aid=%d;";
        	Connection::setQueryf($sql, $val, $aid);
    		exit;
    	}
	}
    Connection::setQuery("SELECT * FROM settings");
    $settings = Connection::fetch();
?>